package day7;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

public
class TestMap {
    public static
    void main(String[] args) {
        Map<String,Integer> map=new HashMap<>();//线程不安全 允许key,value为null
        Map<String,Integer> map1=new Hashtable<>();//线程安全 不允许key,value为null
        map.put("java",1);
        map.put("c++",2);
        map.put("python",3);
        Iterator<Map.Entry<String,Integer>> it=map.entrySet().iterator();
        while (it.hasNext()){
            Map.Entry<String, Integer> s=it.next();
            System.out.println(s.getKey()+" "+s.getValue());
        }

    }
}
